/**
 * author:Administrator
 * date:2016/1/6
 * desc:TODO
 */

'use strict';

var Model = require('../model/book.js');
var Sequelize = require('sequelize');
var sequelize = require('../conn/sequelize.js');

var dao = {};
module.exports = dao;

/**
 * create
 */
dao.create = function*(name, uid) {
  var entity = {name: name};
  if (typeof uid !== 'undefined') entity.uid = uid;
  var account = yield Model.create(entity);
  return account;
};


/**
 * query
 */
dao.findById = function *(id) {
  return yield Model.findOne({where: {id: id}});
};
